<?
require_once('config.php');
$action = getValue('action','str','POST');
if($action == 'submit'){
   $mod_name = getValue('mod_name','str','POST');
   $mod_dir = getValue('mod_dir','str','POST');
   $mod_file = getValue('mod_file','str','POST');
   $mod_order = getValue('mod_order','int','POST');
   $mod_sub = getValue('mod_sub','str','POST');   
   
   Module::addModule($mod_name,$mod_dir,$mod_file,$mod_sub,$mod_order);
   echo '<span style="color: #01B42C;font-size: 14px;font-weight: bold;">Thêm thành công</span>';
}
$total = Module::getTotal();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thêm mới <?=$moduol_name?></title>
   <?=$css_module?>
   <?=$js_module?>
</head>
<div class="row-fluid">
   <div class="head">
      <div class="isw-grid"></div>
      <h1>Thêm mới <?=$moduol_name?></h1>      
      <div class="reload_tab" title="Reload"></div>                         
      <div class="clear"></div>
   </div>
   <div class="block-fluid">
      <form class="form-horizontal" name="add" action="" method="POST" enctype="multipart/form-data"  onsubmit="">
         <input type="hidden" name="action" value="submit" />
         <fieldset>
            <div class="control-group">
               <label class="control-label" >Tên module</label>
               <div class="controls">
                  <input type="text" class="input-xlarge tooltip-right span3" id="mod_name" name="mod_name" title="Tên module" placeholder="Tên module" />
					</div>
            </div>
            <div class="control-group">
               <label class="control-label" >Tên thư mục</label>
               <div class="controls">
						<input type="text" class="input-xlarge tooltip-right span3" id="mod_dir" name="mod_dir" title="Tên thư mục" placeholder="TenThuMuc"/>
					</div>
            </div>
            <div class="control-group">
               <label class="control-label" >Tên file</label>
               <div class="controls">
						<input type="text" class="input-xlarge tooltip-right span3" id="mod_file" name="mod_file" placeholder="list.php|add.php" title="Phân cách nhau bơi dấu |"/>
					</div>
            </div>
            <div class="control-group">
               <label class="control-label" >Vị trí</label>
               <div class="controls">
                  
						<select id="mod_order" class="span3" name="mod_order">
                     <option value="1">Đầu tiên</option>
                     <?if($total > 1):?>
                        <?for($i = 2;$i <= $total; $i++):?>
                           <option value="<?=$i?>"><?=$i?></option>
                        <?endfor?>
                        <option value="<?=$total+1?>"> Cuối cùng</option>
                     <?endif?>
                  </select>
					</div>
            </div>
            <div class="control-group">
					<label class="control-label" >Sub module</label>
               <div class="controls">
						<input type="text" class="input-xlarge tooltip-right span3" id="mod_sub" name="mod_sub" placeholder="Danh sách|Thêm mới" title="Tên module con"/>
					</div>
				</div>
            
            <div class="form-actions">
					<button type="submit" class="btn btn-info">Thêm mới</button>
					<button type="reset"  class="btn btn-warning">Làm lại</button>
				</div>
         </fieldset>
      </form>
   </div> 
</div>